package pm.util;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class UTF8EncodingFilter implements Filter {
	 private FilterConfig config = null;

	    public void init(FilterConfig arg0) throws ServletException {
	        this.config = arg0;

	    }

	    public void doFilter(ServletRequest req, ServletResponse res, FilterChain fc) throws IOException, ServletException {
	        if (this.config == null) {
	            return;
	        }
	        //System.out.println("filter running");
	        req.setCharacterEncoding("UTF-8");
	        fc.doFilter(req, res);
	    }

	    public void destroy() {
	    }
}
